package com.xufang.cloud.business.base.controller;

import com.xufang.cloud.business.base.entity.CostItem;
import com.xufang.cloud.business.base.mapper.CostItemMapper;
import com.xufang.cloud.business.base.util.ResultMap;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "1.1", value = "消费项目", description = "消费项目")
public class CostItemController extends BaseController {

    @Autowired
    private CostItemMapper costItemMapper;

    @GetMapping("/all")
    @ApiOperation(value = "获取所有消费项目")
    public ResultMap All(){
        List<CostItem> list = this.costItemMapper.selectAll();
        if(list.size()>0){
            return this.resultMap.success().data(list);
        } else {
            return this.resultMap.fail();
        }
    }
}
